This tutorial shows how to add a View into an existing Container View.
In this tutorial we will add a Button into an existing Vertical Stack.
View can be added in following ways (changes are automatically reflected in all places)
● manually type inside Code
● drag and drop from Library into Code
● drag and drop from Library into Design View
When adding a View from a Library into Design View pay attention to the messages that appear
● insert into Vertical Stack
● insert into new Vertical Stack
Add a Button into an existing Vertical Stack
ContentView.swift
struct ContentView: View {
var body: some View {
VStack {
Button(action: {}) {
Text("Button")
}
}
}
}